package com.gzsxy.esjy.service.statistical.config;



import com.gzsxy.esjy.service.statistical.filter.AuthInterceptor;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xiaolong
 * @version 1.0
 * @description: TODO
 * @date 2022/1/19 17:29
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {


    @Bean
    Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }


    /**
     * 自定义请求拦截
=
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInterceptor())
                //添加需要验证登录用户操作权限的请求
                .addPathPatterns("/**")
                //排除不需要验证登录用户操作权限的请求
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/images/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
